<template>
  <view class="container">
    <view  class="list" v-if="dataList.length > 0">
      <view>
        <view class="list-item" style="display: flex" v-for="item in dataList" :key="item.projectId">
          <view style="display: flex">
            <view v-if="item.status === 1" style="height: 40px; width: 40px; border-radius: 5px; background: linear-gradient(135deg, #07C160, #00D976); text-align: center; line-height: 40px; color: #FFFFFF">
              <TnIcon :name="item.status === 1 ? 'payment-wechat' : 'payment-wechat'" size="30px"></TnIcon>
            </view>
            <view v-else style="height: 40px; width: 40px; border-radius: 5px; background: linear-gradient(135deg, #333333, #999999); text-align: center; line-height: 40px; color: #FFFFFF">
              <TnIcon name="payment-wechat" size="30px"></TnIcon>
            </view>
            <view style="margin-left: 10px; font-weight: bold; font-size: 14px">
              <view class="mr4px" style="font-size: 14px; font-weight: 500; color: #00D976" v-if="item.status === 1">
                提现成功(服务费{{item.withdrawnAmount}}元)
              </view>
              <view class="mr4px" style="font-size: 14px; font-weight: 500; color: red" v-if="item.status === 2">
                提现失败
              </view>
              <view class="mr4px" style="font-size: 14px; font-weight: 500; color: #339af0" v-if="item.status === 3">
                转账中
              </view>
              <view style="color: #999999; margin-top: 5px; font-size: 12px;">{{item.createTime || ''}}</view>
            </view>
          </view>
          <view style="text-align: right">
            <view class="mr4px" style="font-size: 18px; font-weight: bold; color: #efa401">-{{(item.withdrawnAmount).toFixed(2)}}</view>
          </view>
        </view>
        <view style="height: 50px"></view>
      </view>
    </view>
    <view v-else>
      <no-data message="暂无记录"></no-data>
    </view>
  </view>
</template>

<script setup lang="ts">
import {onMounted, ref} from "vue";
import NoData from "@/composables/noData/NoData.vue";
import {withdrawalListApi} from "@/api/pay";
const dataList = ref([]);
const single = ref("");
const getDataList = async () => {
  const res = await withdrawalListApi("2025-09");
  console.log(res);
  dataList.value = res?.data || [];
}
onMounted(() => {
  getDataList();
})
</script>

<style scoped lang="scss">
.list-title {
  color: #333333;
  font-weight: bold;
  font-size: 32rpx;
  margin-left: 32rpx;
}
.list {
  margin-top: 32rpx;
  .list-item {
    width: calc(100vw - 64rpx);
    margin-bottom: 10px;
    height: 78px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    margin-left: 32rpx;
    padding: 24rpx;
    .list-item-left {
      display: flex;
      width: 400rpx;
      align-items: center;
      justify-content: left;
      .list-item-left-box {
        width: 100%;
        margin-left: 24rpx;
        .list-item-left-text {
          font-size: 30rpx;
          color: #333333;
          font-weight: 600;
        }
        .list-item-left-time-text {
          color: #999999;
          font-size: 24rpx;
          margin-top: 20rpx;
        }
      }
      .img {
        min-width: 64rpx;
        min-height: 64rpx;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
      }

    }
    .right-icon {
      margin-left: 3rpx;
    }
    .mr4px {
      margin-right: 8rpx;
    }
  }
}
</style>
